package com.my.auth.security;

import com.my.auth.security.model.Authentication;

import java.io.Serializable;

/**
 * @author zhaodongchao
 * @date 2020/3/28 17:59
 **/
public interface SecurityContext  extends Serializable {
    /**
     * Obtains the currently authenticated principal, or an authentication request token.
     *
     * @return the <code>Authentication</code> or <code>null</code> if no authentication
     * information is available
     */
    Authentication getAuthentication();

    /**
     * Changes the currently authenticated principal, or removes the authentication
     * information.
     *
     * @param authentication the new <code>Authentication</code> token, or
     * <code>null</code> if no further authentication information should be stored
     */
    void setAuthentication(Authentication authentication);
}
